package puffer.starter.db.strengthen;

import puffer.starter.db.entity.Dnt;
import puffer.starter.util.ContextKit;

import java.util.List;

/**
 * 数据操作强化工具类
 */
public class DbKit {

    public static Dnt fillInsert(Dnt ent) {
        DbFillHandler insert = ContextKit.getBean(DbFillHandler.class);
        insert.insertFill(ent);
        return ent;
    }

    public static List<Dnt> fillInsert(List<Dnt> list) {
        DbFillHandler insert = ContextKit.getBean(DbFillHandler.class);
        for (Dnt dnt : list) {
            insert.insertFill(dnt);
        }
        return list;
    }

    public static Dnt fillUpdate(Dnt ent) {
        DbFillHandler update = ContextKit.getBean(DbFillHandler.class);
        update.updateFill(ent);
        return ent;
    }

    public static Wrapper<Object> fillUpdate(Wrapper<Object> uW) {
        DbFillHandler update = ContextKit.getBean(DbFillHandler.class);
        update.wrapperUpdateFill(uW);
        return uW;
    }

    public static List<Dnt> fillUpdate(List<Dnt> list) {
        DbFillHandler update = ContextKit.getBean(DbFillHandler.class);
        for (Dnt dnt : list) {
            update.updateFill(dnt);
        }
        return list;
    }

    public static Dnt fillDelete(Dnt ent) {
        DbFillHandler delete = ContextKit.getBean(DbFillHandler.class);
        delete.deleteFill(ent);
        return ent;
    }

    public static Wrapper<Object> fillDelete(Wrapper<Object> uW) {
        DbFillHandler update = ContextKit.getBean(DbFillHandler.class);
        update.wrapperDeleteFill(uW);
        return uW;
    }

    public static List<Dnt> fillDelete(List<Dnt> list) {
        DbFillHandler delete = ContextKit.getBean(DbFillHandler.class);
        for (Dnt dnt : list) {
            delete.deleteFill(dnt);
        }
        return list;
    }

    public static Wrapper<Object> fillSelect(Wrapper<Object> uW) {
        DbFillHandler update = ContextKit.getBean(DbFillHandler.class);
        update.wrapperQueryFill(uW);
        return uW;
    }

}
